<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<html:form action="user.do?method=save" method="post">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableline" id="Table3">
    <tr >
      <td colspan="2"></td>
    </tr>
    <tr class="m_lef">
      <td height="40" colspan="2" align="center" bgcolor="#ffffff" class="STYLE4">系统帐号管理</td>
    </tr>
    <tr class="m_lef">
      <td width="144" height="26" align="right" bgcolor="#ffffff">帐号：</td>
      <td width="712" bgcolor="#ffffff">&nbsp;<html:text property="username" value="${user.username }"/><font color="red">${error }</font></td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff">密码：</td>
      <td bgcolor="#ffffff">&nbsp;<html:password property="password" />
        </td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">重复密码：</font></td>
      <td bgcolor="#ffffff">&nbsp;<html:password property="password2" />
        </td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">用户姓名：</font></td>
      <td bgcolor="#ffffff">&nbsp;<html:text property="nickname" value="${user.nickname }"/></td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">管理员身份：</font></td>
      <td bgcolor="#ffffff">
      <c:if test="${!empty roles}">
	  <c:forEach items="${roles }" var="role">
	  <html:multibox property="roleIds" value="${role.id }"></html:multibox>${role.description}
	  </c:forEach>
	  </c:if>
	  </td>
    </tr>
    <tr>
      <td height="30" colspan="8" align="center" bgcolor="#ffffff" class="c_foot">
        <html:submit value="添加"/> <html:reset value="重置" /> </td>
    </tr>
  </table>
  </html:form>
  
  <br />
  <table id="Table4" bordercolor="#ffffff" height="29" cellspacing="1" cellpadding="1" width="90%"
				align="center" bgcolor="#999999" border="1">
    <tr align="center" bgcolor="#b61a1a" height="25">
      <td width="25%"><font color="#ffffff"><b>帐号</b></font></td>
      <td width="25%"><font color="#ffffff"><b>用户名称</b></font></td>
      <td width="25%"><font color="#ffffff"><b>用户身份</b></font></td>
      <td width="25%"><font color="#ffffff"><b>操作</b></font></td>
    </tr>
    <c:if test="${!empty users}">
		<c:forEach items="${users}" var="user">
         <tr align="center" bgcolor="#f2f2f2" style="BACKGROUND-COLOR: #f2f2f2" onmouseover="this.style.backgroundColor='#FFCC99'"
							onmouseout="this.style.backgroundColor='#f2f2f2'" height="25">
          <td>${user.username }</td>
          <td>${user.nickname }</td>
          <td>
        <c:if test="${!empty user.roles}">
		<c:forEach items="${user.roles}" var="role">
		${role.description }
		</c:forEach>
		</c:if>
          </td>
          <td align="center">
          <a href="user.do?method=toUpdate&id=${user.id }">编辑</a>&nbsp;
          <a href="user.do?method=delete&id=${user.id }">删除</a></td>
        </tr>
        </c:forEach>
     </c:if>
     </table>
</body>
</html>